﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace McHotspoot
{
    public interface McHotspotI
    {
        /// <summary>
        /// Generates samples of one task
        /// </summary>
        /// <param name="key">Key genereted on 'Run' method</param>
        /// <param name="n">Total samples of this task difined by framework</param>
        /// <param name="index">Index of this task defined by framework</param>
        /// <param name="codein">Same code fragment received on 'Run' method</param>
        /// <param name="message">Returns message log to framework</param>
        /// <returns>String with task results processed</returns>
        string execute(string key, double n, double index, string codein, out string message);

        /// <summary>
        /// Calculates the approximation of simulation
        /// </summary>
        /// <param name="key">Key genereted on 'Run' method</param>
        /// <param name="n">Total samples received on 'Run' method</param>
        /// <param name="r">File address with all tasks results</param>
        /// <param name="codein">Same code fragment received on 'Run' method</param>
        /// <param name="codeout">Same code fragment received on 'Run' method</param>
        /// <param name="message">Returns message log to framework</param>
        /// <returns>String with simulation approximation calculated</returns>
        string finish(string key, double n, string r, string codein, string codeout, out string message);

        /// <summary>
        /// Tests the parameter received on 'Run' method
        /// </summary>
        /// <param name="key">Key genereted on 'Run' method</param>
        /// <param name="n">Total samples received on 'Run' method</param>
        /// <param name="codein">Same code fragment received on 'Run' method</param>
        /// <param name="codeout">Same code fragment received on 'Run' method</param>
        /// <param name="npt">Same maximum samples by task received on 'Run' method</param>
        /// <returns>Returns a message if a problem comes up</returns>
        string test(string key, double n, string codein, string codeout, double npt);

        /// <summary>
        /// Estimates the best framework configuration to run this simulation 
        /// </summary>
        /// <param name="n">Total samples received on 'Run' method</param>
        /// <param name="codein">Same code fragment received on 'Run' method</param>
        /// <param name="codeout">Same code fragment received on 'Run' method</param>
        /// <param name="npt">Same maximum samples by task received on 'Run' method</param>
        /// <param name="ninstancesadded">Amount of new worker nodes to initialize</param>
        /// <param name="ntasks">Amount of tasks to split this simulation</param>
        /// <param name="timeoutInSeconds">Maximum time to wait the execute of task</param>
        void optimization(double n, string codein, string codeout, double npt, 
            out double ninstancesadded, out double ntasks, out int timeoutInSeconds);        
    }
}
